/*
** basics.c for my_printf in /home/nadali_t//local/svn/tek2ed/my_printf
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Sun Nov 18 16:33:10 2012 thomas nadalie
** Last update Sun Nov 18 16:33:11 2012 thomas nadalie
*/

#include	<unistd.h>
#include	"my.h"

void		my_putchar(char c)
{
  write(1, &c, 1);
}

void		my_putstr(const char *str)
{
  int		i;

  i = 0;
  while (str[i])
    my_putchar(str[i++]);
}

int             epur_buff(char *buff, int i)
{
  while (buff[i] == ' '  && buff[i])
    i++;
  return (i);
}

int		my_strcpr(char *str, char *str2)
{
  int		i;
  int		j;

  i = epur_buff(str, 0);
  j = 0;
  while (str[i])
    {
      if (str[i] != str2[j] && str2[j])
        return (0);
      if (str2[j] == '\0' && str[i] == ' ')
        {
          i = epur_buff(str, i);
          if (str[i] == '\0')
            return (1);
          else
            return (0);
        }
      i++;
      j++;
    }
  if (str[i] == str2[j])
    return (1);
  else
    return (0);
}

int		my_strlen(const char *str)
{
  int		i;

  i = 0;
  while (str[i])
    i++;
  return (i);
}
